package com.example.hr.text_android;

import android.support.design.widget.TabLayout;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.example.hr.text_android.fragment.MyFragmentPagerAdapter;

public class Main2Activity extends FragmentActivity {

    private ViewPager mViewPager;
    private MyFragmentPagerAdapter myFragmentPagerAdapter;
    private TabLayout mTabLayout;

    private TabLayout.Tab one;
    private TabLayout.Tab two;
    private TabLayout.Tab three;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        initViews();
    }

    private void initViews() {

        //使用适配器将ViewPager与Fragment绑定在一起
//        mViewPager = (ViewPager) findViewById(R.id.viewpager);
//        mTabLayout = (TabLayout) findViewById(R.id.tabletlayout);
//        myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
//        mViewPager.setAdapter(myFragmentPagerAdapter);
//        //将TabLayout与ViewPager绑定在一起
//        mTabLayout.setupWithViewPager(mViewPager);
//
//        one = mTabLayout.getTabAt(0);
//        two = mTabLayout.getTabAt(1);
//        three = mTabLayout.getTabAt(2);
        //使用适配器将ViewPager与Fragment绑定在一起
//        mViewPager= (ViewPager) findViewById(R.id.viewpager);
//        myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
//        mViewPager.setAdapter(myFragmentPagerAdapter);
//
//        //将TabLayout与ViewPager绑定在一起
//        mTabLayout = (TabLayout) findViewById(R.id.tabletlayout);
//        mTabLayout.setupWithViewPager(mViewPager);
//
//        //指定Tab的位置
//        one = mTabLayout.getTabAt(0);
//        two = mTabLayout.getTabAt(1);
//        three = mTabLayout.getTabAt(2);


    }
}
